{include file="common/_meta" /}
<title>添加管理员 - 管理员管理 </title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
	<article class="cl pd-20">
		<form action="" method="post" class="form form-horizontal" id="form-category-add-lizhili">
			<input type="hidden" name="id" value="{$data.id}" />
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>管理员：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.username}" placeholder="" id="username" name="username">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">留空不修改密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" autocomplete="off" value="" placeholder="密码" id="password" name="password">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">角色：</label>
				<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
						<select class="select" name="role" size="1">
							{volist name="res" id="vo"}
							<option value="{$vo.id}" <?php if($data['role']==$vo['id']){ echo 'selected' ;} ?> >{$vo.title}</option>
							{/volist}
						</select>
					</span> </div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">备注：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<textarea name="desc" id="desc" class="textarea" <?php if($data['id']==1){ echo 'disabled' ;} ?> onKeyUp="textlength()">{$data.mark}</textarea>
					<p class="textarea-numberbar"><em class="textarea-length">{$data.desc|mb_strlen}</em>/200</p>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input id="tijiao" class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
	{include file="common/_footer" /}
	<script type="text/javascript" src="__ADMIN__lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="__ADMIN__lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="__ADMIN__lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});
			$("#form-category-add-lizhili").validate({
				rules:{
					username: {
						required: true,
						minlength: 4,
						maxlength: 16,
					},
					adminRole: {
						required: true,
					},
				},
				submitHandler:function(form) {
					$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
					var index = layer.load(1, {
						shade: [0.1,'#fff'] //0.1透明度的白色背景
					});
					setTimeout(()=>{
						$("input[type=\"submit\"]").removeClass('disabled').attr("disabled",false);
						layer.close(index);
					},1000)
					form.submit();
				}
			});

		});
		function textlength(obj, max) {
			var nmb=$('#mark').val().length;
			if(nmb>200){
				$('#mark').css("background-color","orangered");
				$('#mark').val($('#mark').val().substr(0,200));
				$('.textarea-length').text(200);
			}else{
				$('#mark').css("background-color","white");
				$('.textarea-length').text(nmb);
			}
		}
	</script>
</body>
</html>
